// config/database.js
const mongoose = require("mongoose");

const connectDB = async () => {
  try {
    await mongoose.connect("mongodb://localhost:27017/testDB"); //例如:mongodb://localhost:27017/xxxx
    console.log("MongoDB 数据库连接成功");
  } catch (err) {
    console.error(err, "连接数据库失败");
  }
};

module.exports = connectDB;
